
const globalModule = {
    namespaced: true,
    state: {
        open_windows: [],
        active_window: "",
    },
    getters: {
        screenSize: state => {
            let winWidth = 0;
            if (window.innerWidth) {
                winWidth = window.innerWidth;
            } else if ((document.body) && (document.body.clientWidth)) {
                winWidth = document.body.clientWidth;
            }

            if(winWidth<768){
                return "xs"
            }
            if(winWidth>=768&&winWidth<992){
                return "sm"
            }
            if(winWidth>=992&&winWidth<1200){
                return "md"
            }
            if(winWidth>=1200&&winWidth<1920){
                return "lg"
            }
            if(winWidth>=1920){
                return "xl"
            }
        }
    },
    mutations: {
        setOpenWindows(state, wins) {
            state.open_windows = wins;
        },
        setActiveWindow(state, path) {
            state.active_window = path;
        },
    },
    actions: {
        submit({ commit }) {
            commit('submit')
        },
    }
}

export default globalModule;